import request from '@/utils/request'
import {getToken} from "@/utils";

export default {
    answer(data:any) {
        return request({
            url: '/open/test',
            method: 'post',
            data
        })
    }
}

export const senMessage = ({ message, sessionId }) => {
    return request({
        url: `/chatgpt/message`,
        data: {
            sessionId,
            message
        },
        method: 'post',
        headers:{"third-session":getToken()}
    })
}


export const deleteSession = (sessionId: string) => {
    return request({
        url: '/chatgpt/delete/' + sessionId,
        method: 'delete',
    })
}

export const getHistoryMessage = () => {
        return request({
            url: '/chatgpt/history',
            method: 'get',
        })
}

export const createSession = (data: { name: string, sessionId: string}) => {
    return request({
        url: '/chatgpt/saveSession',
        method: 'post',
        data
    })
}

export const updateSession = (data: { name: string, sessionId: string}) => {
    return request({
        url: '/chatgpt/updateSession',
        method: 'put',
        data
    })
}
